package com.github.soiff.shadow.plugin.helper;

import com.github.jknack.handlebars.Helper;
import com.github.jknack.handlebars.Options;

import java.io.IOException;
import java.net.URLEncoder;

/**
 * Created by Soiff on 2016/05/20.
 *
 * @author : Soiff
 */
public class UrlEncodeHelper implements Helper {
    @Override
    public CharSequence apply(Object param, Options options) throws IOException {
        String charset = options.param(0, "utf-8");
        return URLEncoder.encode(param.toString(), charset);
    }
}
